package secondStage.part2.内部类.five;

/**
 * @ClassName: [JumppingDemo]
 * @Description: 匿名内部类测试类
 * @Author: [黄劲松]
 * @CreateDate: [2021-03-21]
 * @Version: [v1.0]
 */
public class JumppingDemo {
    public static void main(String[] args) {
        //创建对象，调用方法
        JumppingOperator jp = new JumppingOperator();
        Jumpping j = new Cat();
        jp.method(j);

        Jumpping j2 = new Dog();
        jp.method(j2);
        System.out.println("-----内部类改进，可以省略Cat类和Dog类的创建-------");
        jp.method(new Jumpping() {
            @Override
            public void jump() {
                System.out.println("马儿草料");
            }
        });
    }
}
